﻿using System;
using QDT.Common;

namespace QDT.Core.Members
{
    /// <summary>
    /// 用户操作日志信息类
    /// </summary>
    public class UserTransLog:Entity,IAggregeRoot
    {

        public UserTransLog()
        {
        }

        public UserTransLog(int userID,TradeType tradeType,decimal money = 0,decimal overMoney = 0,  string operatorUser = "系统") {
            
            UserID = userID;

            Trade = tradeType;
            
            Money = money;

            OverMoney = overMoney;

            TradeUser = operatorUser;

            Time = DateTime.Now;

        }

        /// <summary>
        /// 用户ID
        /// </summary>
        public int UserID { get; set; }

        /// <summary>
        /// 交易类型
        /// </summary>
        public TradeType Trade { get { return (TradeType) InnerTrade; }set { InnerTrade = (int) value; } }

        public int InnerTrade { get; set; }

        /// <summary>
        /// 操作日志信息备注
        /// </summary>
        public string Info { get; set; }

        /// <summary>
        /// 操作时间
        /// </summary>
        public DateTime Time { get; set; }

        /// <summary>
        /// 资金变动
        /// </summary>
        public decimal Money { get; set; }

        /// <summary>
        /// 资金变动
        /// </summary>
        public decimal LockMoney { get; set; }

        /// <summary>
        /// 可用余额
        /// </summary>
        public decimal OverMoney { get; set; }

        /// <summary>
        /// 操作人
        /// </summary>
        public string TradeUser { get; set; }

        public enum TradeType {

            [EnumItemDescription("其他")]
            Other = 0,

            //资金充值
            [EnumItemDescription("充值")]
            Charge = 1,

            /// <summary>
            /// 提现冻结
            /// </summary>
            [EnumItemDescription("提现冻结")]
            CarrayMoneyToLock = 2,

            [EnumItemDescription("提现失败")]
            CarrayFaild=3,

            /// <summary>
            /// 提现冻结金支付,解除冻结
            /// </summary>
            [EnumItemDescription("提现支付")]
            CarrayLockMoneyDefray = 4,

            /// <summary>
            /// 投资支付,解除冻结
            /// </summary>
            [EnumItemDescription("投资支付")]
            InvestmentToPay = 5,

            //投资冻结
            [EnumItemDescription("投资冻结")]
            InvestToLock = 6,

            [EnumItemDescription("投资失败")]
            InvestFaild=7,

            /// <summary>
            /// 回收利息
            /// </summary>
            [EnumItemDescription("回收利息")]
            RecoverInterest = 8,

            /// <summary>
            /// 回收本金
            /// </summary>
            [EnumItemDescription("回收本金")]
            RecoverPrincipal = 9,

            [EnumItemDescription("借款成功")]
            BorrowMoney = 10,

            [EnumItemDescription("借款划出")]
            RemitMoney=11,

            [EnumItemDescription("卖出债权")]
            SellCredit = 12
        }

    }
}
